<template>
  <div class="wrapper">
    <swiper :options="swiperOption"  ref="mySwiper">
        <swiper-slide v-for="item of swiperList" :key="item.id" >
          <img class="swiper-img" :src="item.imgUrl" alt="" >
        </swiper-slide>
        <div class="swiper-pagination"  slot="pagination"></div>
      </swiper>
  </div>
</template>

<script>
import { swiper, swiperSlide } from 'vue-awesome-swiper'
export default {
  name: 'HomeSwiper',
  components: {
    swiper,
    swiperSlide
  },
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination'
      },
      swiperList: [{
        id: '001',
        imgUrl: '//qimgs.qunarzz.com/dmf_ad_peri.OPERATION.prod/20240301_qunar_dujia_homepage_a750x192_v2.jpg'
      }, {
        id: '002',
        imgUrl: '//qimgs.qunarzz.com/dmf_ad_peri.OPERATION.prod/20231214_qunar_dujia_homepage_a750x192_V1.jpg'
      }]
    }
  }

}
</script>

<style lang='stylus' scope>
/* 这里有个知识点:当图片未加载成功时,需要对父元素设置高或者BFC,但因为图片宽:高是100:31,高是自适应,所以父高不能设置固定,可以通过 padding属性,上下设值是宽度的占比*/
.swiper-pagination-bullet-active
  background: #fff
.wrapper
  width: 100%
  overflow:hidden
  height: 0
  padding-bottom: 25.6%
  background: #aaa
.swiper-img
  width: 100%

</style>
